/********************************************************/
/*	Copyright (C) 2016 Gong Li Bin			*/
/*	Project:	GlbCloud			*/
/*	Author:		gong_libin			*/
/*	Date:		2012_01_06			*/
/*	File:		MrGlobal.h			*/
/********************************************************/

#ifndef	_MRGLOBAL_H
#define	_MRGLOBAL_H

#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>

#define	UINT				unsigned int
#define	UCHAR				unsigned char
#define	ULONG				unsigned long
#define	USHORT				unsigned short
#define	ULONGLONG			unsigned long long

#define	MR_VALUE			128
#define	MR_BUFFER			512
#define	MR_PACKET			1024

#define	MR_MACIPUDP			42
#define	MR_MACIPTCP			54
#define	MR_ETHERNET			1500

#define	MR_BIGPACKET			MR_PACKET * 10

#define	MR_SUCCESS			0
#define	MR_FAILURE			-1

#define	MR_INFO(format, args...)	do {				\
	fprintf(stdout, "[INFO] %s %04d: ", __FILE__, __LINE__);	\
	fprintf(stdout, format, ##args);				\
} while (0)

#define	MR_WARN(format, args...)	do {				\
	fprintf(stdout, "[WARN] %s %04d: ", __FILE__, __LINE__);	\
	fprintf(stdout, format, ##args);				\
} while (0)

#define	MR_PRINT(format, args...)	do {				\
	fprintf(stdout, format, ##args);				\
	fflush(stdout);							\
} while (0)

#define	MR_ERROR(format, args...)	do {				\
	fprintf(stderr, "[ERROR] %s %04d: ", __FILE__, __LINE__);	\
	fprintf(stderr, format, ##args);				\
} while (0)

#define	MR_DEBUG(format, args...)	do {				\
	fprintf(stdout, "[DEBUG] %s %04d: ", __FILE__, __LINE__);	\
	fprintf(stdout, format, ##args);				\
	fflush(stdout);							\
} while (0)

#ifdef __cplusplus
}
#endif /* __cplusplus */

#endif /* _MRGLOBAL_H */
